import { onHide } from '@dcloudio/uni-app';
<!--
 * @Description:
 * @Date: 2024-05-14 09:00:16
 * @LastEditTime: 2024-10-11 14:03:36
-->
<route lang="json5" type="login">
{
  style: {
    navigationStyle: 'custom',
    navigationBarTitleText: '登录',
  },
}
</route>
<template>
  <view class="w-screen h-screen flex flex-col justify-center items-center">
    <image class="w-screen h-screen pos-absolute" :src="loginBg" mode="scaleToFill" />
    <view class="w-100% flex flex-col mt-150rpx items-center pos-relative">
      <view class="w-full login-btn mb-30rpx">
        <button
          class="bg-#4D80F0 text-#fff text-30rpx h-80rpx rounded-20rpx"
          @click="handleLogin('leaderLogin')"
        >
          检察官
        </button>
        <button
          class="bg-#4D80F0 text-#fff text-30rpx h-80rpx rounded-20rpx mt-4"
          @click="handleLogin('peopleLogin')"
        >
          市民
        </button>
      </view>
      <view
        class="w-100% h-85% pos-absolute top-0 left-0"
        v-if="!privacy"
        @click.self="ifPrivacy"
      ></view>
      <view class="mx-auto my-0 flex">
        <wd-checkbox v-model="privacy"></wd-checkbox>
        <text class="text-24rpx color-#999999">
          已阅读并同意
          <text class="color-#000" @click="agreement">《用户服务协议》</text>
          及
          <text class="color-#000" @click="intimacy">《隐私政策》</text>
        </text>
      </view>
    </view>
  </view>
</template>

<script setup lang="ts">
import { useUserStore } from '@/store'
import { useMessage } from 'wot-design-uni'
import loginBg from '../../static/login/bg.png'
const privacy = ref(false)
const message = useMessage()
const loginCode = ref('')
const userStore = useUserStore()
onShow(() => {
  console.log('login---------')
})
const agreement = () => {
  uni.navigateTo({ url: '/pages/login/agreement' })
}
const intimacy = () => {
  uni.navigateTo({ url: '/pages/login/intimacy' })
}
function handleLogin(url) {
  uni.navigateTo({ url: `/pages/login/${url}` })
}
const ifPrivacy = () => {
  message
    .confirm({
      title: '用户协议及隐私政策',
      msg: '请先阅读并同意《用户服务协议》和《隐私政策》',
    })
    .then(() => {
      privacy.value = true
    })
    .catch(() => {
      privacy.value = false
    })
}
</script>
<style lang="scss" scoped>
.login-btn {
  width: 60%;
}

::v-deep .wd-button {
  width: 100%;
}
</style>
